<?php
//测试专用

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Route;

//login
Route::get('login','LoginController@login');

//Register
Route::any('register','RegisterController@userRegister');
//check_login
Route::post('checkLogin','LoginController@checkLogin');
//home
Route::get('home','HomeController@index');

//input
Route::get('companys','InputController@companys');

//通过公司获取部门信息
Route::post('getDepts','InputController@getDepts');

//文件上传测试
Route::any('uploadFiles','FilesController@uplOAdFiles');

//文件下载
Route::post('downloadFiles','FilesController@downlOAdFiles');

//币种相关
Route::group(['prefix'=>'/currency/'],function(){
    Route::any('list','CurrencyController@currencyList');//币种列表
    Route::post('editRate','CurrencyController@editRate');//币种修改
    Route::post('addRate','CurrencyController@addRate');//币种修改

});

//部门设置
Route::group(['prefix'=>'/dept/'],function(){
    Route::any('list','DeptController@deptList');//部门列表
    Route::post('editDept','DeptController@editDept');//部门修改
    Route::post('addDept','DeptController@addDept');//新增部门
});

//用户相关
Route::group(['prefix'=>'/user/'],function(){
    Route::any('list','UserController@userList');//用户列表
    Route::post('editUser','UserController@editUser');//修改用户
});

//城市相关
Route::group(['prefix'=>'/city/'],function(){

    Route::any('list','CityController@cityList');//城市列表

    Route::post('editCity','CityController@editCity');//城市修改
});


//流程相关
Route::group(['prefix'=>'/work/'],function(){

    Route::any('list','WorkController@workList');//流程列表

    Route::post('editWork','WorkController@editWork');//流程修改

    Route::post('addWork','WorkController@addWork');//新增流程

    Route::get('work_detail','WorkController@workDetail');//流程详情

    Route::get('delWork','WorkController@delWork');//删除流程

});

//测试多线程
Route::group(['prefix'=>'/test/'],function(){
        Route::any('pool','TestController@Pool')->name('oa.pool');
});

//common Input
Route::group(['prefix'=>'/common/'],function(){
    //下拉框,公共
    Route::any('input','CommonController@getInput')->name('oa.input');
    //获取职位列表
    Route::any('position_list','CommonController@getPositionList');

    //通过职位获取用户

    Route::get('getUserList','CommonController@getUserListByPositionId');

    //获取所有用户+职位
    Route::get('getAllRoleAndUser','CommonController@getAllRoleAndUser');//id->title

    //获取公司部门
    Route::get('getCompanyDept','CommonController@getCompanyDept');

});

//员工相关
Route::group(['prefix'=>'/staff/'],function(){
    //获取员工列表
    Route::get('list','StaffController@getStaffList');
    //批量删除
    Route::post('batch_del','StaffController@BatchDelete');
    //获取用户详情
    Route::get('staff_info','StaffController@StaffInfo');
    //编辑用户
    Route::post('staff_edit','StaffController@StaffEdit');

    //获取员工职位,角色
    Route::get('staff_position_role','StaffController@StaffPositionRole');
});

//权限相关
Route::group(['prefix'=>'/auth/'],function(){
    //通过职位获取权限
    Route::get('list','AuthController@getAuthListByPositionId');
});

//工具
Route::group(['prefix'=>"/tool/"],function(){
    //上传图像
    Route::post('upload_file','ToolController@uplOAdFile');
});

//项目
Route::group(['prefix'=>"/project/"],function(){
    //立项
    Route::post('addProject','ProjectController@addProject');
    //立项数据
    Route::get('getProjectLx','ProjectController@getProjectLx');
    //立项数据详情
    Route::get('projectDetail','ProjectController@projectDetailLx');
    //编辑立项数据
    Route::post('editProjectLx/{lx}','ProjectController@editProjectLx');
    //编辑预算数据
    Route::post('editProjectYs/{ys}','ProjectController@editProjectYs');
    //修改供应商
    Route::post('editProjectPartner','ProjectController@editProjectPartner');
    //预算数据列表
    Route::get('getYsList','ProjectController@getYsList');
    //获取项目基本信息
    Route::get('projectBase','ProjectController@getProjectBaseInfo');
    //添加预算数据
    Route::post('addProjectYs','ProjectController@addProjectYs');
    //预算详情
    Route::get('getProjectYsDetail/{projectYs}','ProjectController@getProjectYsDetail');
    //获取预算列表
    Route::get('getProjectYsList','ProjectController@getProjectYsList');
    //更新销售经理
    Route::post('updateSeller/{ys}','ProjectController@updateSeller');
    //获取结算列表
    Route::get('getProjectJsSelect','ProjectController@getProjectJsSelect');
    //获取结算数据
    Route::get('getProjectJsData','ProjectController@getProjectJsData');
    //保存结算数据
    Route::post('saveProjectData','ProjectController@saveProjectData');
    //结算数据详情
    Route::get('getJsDetail/{projectJs}','ProjectController@getJsDetail');
    //编辑结算
    Route::post('editProjectJs/{projectJs}','ProjectController@editProjectJs');
    Route::get('delProject','ProjectController@delProject');//删除项目
    Route::get('getYsData','ProjectController@getYsData');//获取预算数据
    Route::post('calculate/profit','ProjectController@calculateProfit');//计算利润
    Route::post("ys/detail/del/{ysDetail}",'ProjectController@delYsDetail');//删除预算
    Route::post('ys/money/{ys}','ProjectController@reCalculateYsProfit');//修改预算金额


});

//职位管理
Route::group(['prefix'=>"/position/"],function(){
    Route::get('list','PositionController@getPositionList');
});


//公司管理
Route::group(['prefix'=>"/company/"],function(){
    //获取公司列表
    Route::get('list','CompanyController@getCompanyList');

    Route::post('edit','CompanyController@editCompany');

    Route::post('del','CompanyController@delCompany');

    Route::post('add','CompanyController@addCompany');


});

//审批记录
Route::group(['prefix'=>"/log/"],function(){
    //添加审批日志记录
    Route::post('add','ShenPiLogController@addShenPiLog');

});

//修改项目流程
Route::post('editProjectState','ShenPiLogController@editProjectState');

//获取待审数目
Route::get('getWaitProject','ProjectMasterController@getWaitProject');

//财务模块

Route::group(['prefix'=>"/finance/"],function(){
    //添加审批日志记录
    Route::post('getClvFee','FinanceController@getClvFee');
    //获取可申请项目列表
    Route::get('getApplyProject','FinanceController@getApplyProject');
    //获取财务模块项目详情
    Route::get('getProjectBase','FinanceController@getProjectBase');
    //添加财务申请
    Route::post('addFinanceData','FinanceController@addFinanceData');
    Route::get('list','FinanceController@getList');//财务列表
    Route::get('detail','FinanceController@getFinanceDetail');//财务列表
    Route::post('edit/{finance}','FinanceController@editFinance');//编辑财务
    Route::get('ticketList','FinanceController@getTicketList');//获取发票列表
    Route::get('ticketInfo','FinanceController@getTicketInfo');//获取发票详情
    Route::post('addTicket','FinanceController@addTicket');//添加发票
    Route::get('getClvData','FinanceController@getClvData');//获取差旅数据
    Route::get('getApplyLog','FinanceController@getApplyLog');//获取审批记录
    Route::post('del/{finance}','FinanceController@deleteFinance');//删除财务记录
    Route::post('add/hzd/{finance}','FinanceController@addFinanceHzd');//添加hzd
    Route::get('del/hzd/{file}',"FinanceController@delFinanceHzd");//删除回执单
    Route::delete('del/clv/{clv}',"FinanceController@delClv");//删除差旅
});


//行政相关
Route::group(['prefix'=>'/admin/'],function(){
    Route::post('signin','AdminController@addSignIn');//添加签到

    Route::post('addBaoXiao','AdminController@addBaoXiao');//添加报销

    Route::get('baoXiaoList','AdminController@baoXiaoList');//获取报销列表

    Route::get('baoXiaoDetail','AdminController@baoXiaoDetail');//获取报销详情

    Route::post('baoXiaoEdit','AdminController@baoXiaoEdit');//编辑报销

    Route::get('getApplyList','AdminController@getApplyList');//获取可申请的行政报销

    Route::get('isAbleApply','AdminController@isAbleApply');//是否可以申请

    Route::post('addAdminWork','AdminController@addAdminWork');//添加行政项目

    Route::get('delAdminData','AdminController@delAdminData');//删除新政数据

    Route::get('getLoginList','AdminController@getLoginList');//获取考勤数据
});

//数据汇总
Route::group(['prefix'=>'/summary/'],function(){
    Route::get('getList','summaryController@getList');//

    Route::get('detail','summaryController@getSummaryDetail');//汇总数据
});

//人事管理
Route::group(['prefix'=>'/personnel/'],function(){
    Route::post('addStaff','personnelController@addStaff');//新建用户
    Route::get('authList','personnelController@getAuthList');//获取权限列表
    Route::get('modelList','personnelController@getModelList');//模块列表
    Route::post('editAuth','personnelController@editAuth');//编辑权限
    Route::post('editModel','personnelController@editModel');//编辑模块
    Route::post('editStaffMsg','personnelController@editStaffMsg');//修改用户信息
    Route::get('delStaff','personnelController@delStaff');//删除用户
});

//报销限制管理
Route::group(['prefix'=>'/limit/'],function(){
    Route::get('list','LimitController@getList');//获取报销限额
    Route::post('edit','LimitController@editLimit');//修改报销限额
});

//邮箱
Route::group(['prefix'=>'/email/'],function(){
    Route::get('list','EmailController@getList');//消息列表
    Route::post('send','EmailController@sendEmail');//发送消息
    Route::get('chart','EmailController@getChartContent');//发送消息
    Route::get('search','EmailController@searchUser');//搜索人员
});

//制度
Route::group(['prefix'=>'/rules/'],function(){
    Route::get('list','ZhiDuController@getList');//制度列表
    Route::post('add','ZhiDuController@addZhidu');//制度列表

});

//物料
Route::group(['prefix'=>'/matter/'],function(){
    Route::post('addmatter','MatterController@addmatter');//添加物料

    Route::post('matterList','MatterController@matterList');//获取物料列表

    Route::post('matterEdit','MatterController@matterEdit');//编辑物料

    Route::post('matterInfo','MatterController@matterInfo');//获取物料详情

    Route::get('my_price_list','MatterController@getMyPriceList');//我的竞价

    Route::get('my_price_result','MatterController@getMyPriceResult');//我的竞价

});

//供应商
Route::group(['prefix'=>'/supplier/'],function(){
    Route::post('register','SupplierController@registerSupplier');//注册供应商

    Route::get('project_list','SupplierController@getProjectList');//获取下拉列表

    Route::post('add_order','SupplierController@addOrder');//添加招标信息

    Route::get('order_detail','OrderController@getOrderDetail'); //获取订单详情

    Route::get('order_list','OrderController@getOrderList'); //获取订单列表

    Route::get('get_order_by_xmid','OrderController@getOrderByXmid'); //通过项目获取订单

});

Route::group(['prefix'=>'/map/'],function (){
    Route::get('list','PositionController@getMappingList');//获取映射列表
    Route::post('edit','PositionController@editMapping');//编辑映射职位
});


Route::post('setUser',function(Request $request){
   $cacheKey = md5('USER_' . time());
   Cache::put($cacheKey,$request->userinfo);
   return response()->json(['access_token'=>$cacheKey]);
});


Route::get('usr',function(Request $request){
   return response()->json(['state'=>'ok','data'=>Cache::get($request->header('Authorization')),'msg'=>'success']);
});


//供应商审批
Route::group(['prefix'=>'/supply/'],function(){
    Route::get('list','SupplierController@getSupplyList');//获取供应商列表
    Route::post('edit','SupplierController@editSupply');//审批供应商
    Route::post('del','SupplierController@delSupply');//删除供应商
});

//修改密码
Route::post('resetPwd','personnelController@editPersonPwd');
Route::resource('notes','NoteController',['only' => ['index','show','store']]);//备注
Route::post('notes/{note}','NoteController@update');//更新
Route::get('notes/{note}','NoteController@destroy');//删除
Route::resource('notices','NoticesController',['only' => ['index','show','store']]);//公告
Route::post('notices/{notice}','NoticesController@update');//更新
Route::get('notices/{notice}','NoticesController@destroy');//删除

Route::resource("forms",'CommonFormController',['only' => ['index','show','store']]);//常用表格
Route::post('forms/{form}','CommonFormController@update');//更新
Route::get('forms/{form}','CommonFormController@destroy');//删除


//公告管理


Route::get('/notice/list','NoticeController@getNotice');//公告列表
Route::post('/notice/add','NoticeController@addNotice');//公告列表
Route::post('/notice/edit/{notice}','NoticeController@editNotice');//公告列表
Route::post('/notice/del/{notice}','NoticeController@delNotice');//公告列表









